From 528c0704e9bbcf18ebbd05e938646a25d56d5480 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Thu, 8 May 2025 14:04:54 +0800 Subject: [PATCH] fix(shell_integration/macOS/FileProviderExt): Add method to acquire user agent in FPUIExtensionService Signed-off-by: Claudio Cambra --- .../FileProviderExt/Services/FPUIExtensionService.swift | 1 + .../Services/FPUIExtensionServiceSource.swift | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Services/FPUIExtensionService.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Services/FPUIExtensionService.swift index 0c3e444a9..a572942a8 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Services/FPUIExtensionService.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Services/FPUIExtensionService.swift @@ -13,6 +13,7 @@ let fpUiExtensionServiceName = NSFileProviderServiceName( ) @objc protocol FPUIExtensionService { + func userAgent() async -> NSString? func credentials() async -> NSDictionary func itemServerPath(identifier: NSFileProviderItemIdentifier) async -> NSString? } diff --git a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Services/FPUIExtensionServiceSource.swift b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Services/FPUIExtensionServiceSource.swift index 5b8fd4575..047572c66 100644 --- a/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Services/FPUIExtensionServiceSource.swift +++ b/shell_integration/MacOSX/NextcloudIntegration/FileProviderExt/Services/FPUIExtensionServiceSource.swift @@ -40,6 +40,14 @@ class FPUIExtensionServiceSource: NSObject, NSFileProviderServiceSource, NSXPCLi //MARK: - FPUIExtensionService protocol methods + func userAgent() async -> NSString? { + guard let account = fpExtension.ncAccount?.ncKitAccount else { + return nil + } + let nkSession = fpExtension.ncKit.getSession(account: account) + return nkSession?.userAgent as NSString? + } + func credentials() async -> NSDictionary { return (fpExtension.ncAccount?.dictionary() ?? [:]) as NSDictionary } -- 2.30.2